package com.sense.cloud.plugin;

import tigase.db.NonAuthUserRepository;
import tigase.server.Packet;
import tigase.xmpp.XMPPException;
import tigase.xmpp.XMPPProcessorIfc;
import tigase.xmpp.XMPPResourceConnection;
import tigase.xmpp.impl.annotation.AnnotatedXMPPProcessor;
import tigase.xmpp.impl.annotation.Handle;
import tigase.xmpp.impl.annotation.Handles;
import tigase.xmpp.impl.annotation.Id;

import java.util.Map;
import java.util.Queue;
import java.util.logging.Logger;

/**
 * Created by local.kanghl on 2018/8/20.
 */

@Id(TestPlugin.ID)
@Handles(
        @Handle(path = {"iq","query","pubsub","error","command","chat","bind","resource",
                            "presence","show","priority","body","subject","delay","message"},
                xmlns = "jabber:client")
)
public class TestPlugin extends AnnotatedXMPPProcessor implements XMPPProcessorIfc {

    private static final Logger log = Logger.getLogger(TestPlugin.class.getName());

    protected static final String ID = "sense-message";

    @Override
    public void process(Packet packet, XMPPResourceConnection session, NonAuthUserRepository repo, Queue<Packet> results, Map<String, Object> settings) throws XMPPException {

        System.out.println("package:"+packet.getElement().toString());

    }

    @Override
    public String id() {
        return ID;
    }
}
